<?php
class CollectQqphotolist extends CollectBase
{

    public static function getPageContent($url) {   
            import("@.ORG.Utility");   
            //$url='http://www.phplover.cn';   
			//G('begin2');
            $pagehtml= Utility::DoGet($url);  
           // G('end2');
            $pagehtml = preg_replace("/　/",'',$pagehtml);   
            $pagehtml=iconv("GB2312","UTF-8//IGNORE",$pagehtml);
            //charset  
			$pageinfo[charset] = 'gb2312';


			
            //desctiption  
            preg_match('@<meta\s+name=\"*description\"*\s+content\s*=\s*([^/>]+)/*>@i',$pagehtml,$matches);  
 
            $desc = trim($matches[1]);  
            $pageinfo['description'] = str_replace("\"", '',$desc);  
              
     
            preg_match('@<meta\s+name=\"*keywords\"*\s+content\s*=\s*([^/>]+)/*>@i',$pagehtml,$matches);  

            $keywords = trim($matches[1]);  
            $pageinfo['keywords'] = str_replace("\"", '',$keywords);  
     
              
            preg_match("/<title>(.*)<\/title>/smUi",$pagehtml, $matches);  
            $pageinfo['title'] = trim($matches[1]);  
            preg_match("/<body.*>(.*)<\/body>/smUi",$pagehtml, $matches);  


			$pagetitle = $pageinfo['title'];
			$pagetitle = explode('_', $pagetitle);
			$pageinfo['title'] = $pagetitle[0];	
			
			if(preg_match('#P-QQ#', $pagehtml)){
				$pagehtml2= file_get_contents(preg_replace("/\.htm.*$/Uisx",".hdBigPic.js?time=0.1353018406448".rand(1000,9999),$url));				
			}

			if(strlen(trim($pagehtml2))<5000 && preg_match('#hdPic#', $pagehtml)){
			    $pagehtml2= file_get_contents(preg_replace("/\.htm.*$/Uisx",".hdPic.js?time=0.1353018406448".rand(1000,9999),$url));
			}

			if($pagehtml2){
				$pagehtml2=iconv("GB2312","UTF-8//IGNORE",$pagehtml2);
				preg_match_all("/'Name'\:'bigimgurl'\,\s*'Content'\:''\,\s*'Attributes'\:\[\]\,\s*'Children'\:\[\{'Name'\:''\,\s*'Content'\:'([^<>]*)'\,\s*'Attributes'\:\[\]\,\s*'Children'\:\[\]\}\]\}\,\{'Name'\:'cnt_article'\,\s*'Content'\:''\,\s*'Attributes'\:\[\]\,\s*'Children'\:\[\{'Name'\:''\,\s*'Content'\:'(.*)'\,\s*'/Uisx",$pagehtml2, $matches3);	
				
				for($i=0;$i<count($matches3[1]);$i++){
				   $pageinfo['message'].="[img]".$matches3[1][$i]."[/img]\r\n".self::replaceHtmlAndJs2($matches3[2][$i])."\r\n";
				}							
				
			}

			$pageinfo['pagehtml'] = $pagehtml;

            return $pageinfo;  
     
    }  
	
}
?>